package com.rds.system.service.impl;

import com.rds.common.utils.DateUtils;
import com.rds.system.domain.RdaTreemenu;
import com.rds.system.mapper.RdaTreemenuMapper;
import com.rds.system.service.IRdaTreemenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 树菜单Service业务层处理
 *
 * @author rds
 * @date 2021-05-27
 */
@Service
public class RdaTreemenuServiceImpl implements IRdaTreemenuService
{
    @Autowired
    private RdaTreemenuMapper rdaTreemenuMapper;

    /**
     * 查询树菜单
     *
     * @param id 树菜单ID
     * @return 树菜单
     */
    @Override
    public RdaTreemenu selectRdaTreemenuById(Long id)
    {
        return rdaTreemenuMapper.selectRdaTreemenuById(id);
    }

    /**
     * 查询树菜单列表
     *
     * @param rdaTreemenu 树菜单
     * @return 树菜单
     */
    @Override
    public List<RdaTreemenu> selectRdaTreemenuList(RdaTreemenu rdaTreemenu)
    {
        return rdaTreemenuMapper.selectRdaTreemenuList(rdaTreemenu);
    }

    /**
     * 新增树菜单
     *
     * @param rdaTreemenu 树菜单
     * @return 结果
     */
    @Override
    public int insertRdaTreemenu(RdaTreemenu rdaTreemenu)
    {
        rdaTreemenu.setCreateTime(DateUtils.getNowDate());
        return rdaTreemenuMapper.insertRdaTreemenu(rdaTreemenu);
    }

    /**
     * 修改树菜单
     *
     * @param rdaTreemenu 树菜单
     * @return 结果
     */
    @Override
    public int updateRdaTreemenu(RdaTreemenu rdaTreemenu)
    {
        return rdaTreemenuMapper.updateRdaTreemenu(rdaTreemenu);
    }

    /**
     * 批量删除树菜单
     *
     * @param ids 需要删除的树菜单ID
     * @return 结果
     */
    @Override
    public int deleteRdaTreemenuByIds(Long[] ids)
    {
        return rdaTreemenuMapper.deleteRdaTreemenuByIds(ids);
    }

    /**
     * 删除树菜单信息
     *
     * @param id 树菜单ID
     * @return 结果
     */
    @Override
    public int deleteRdaTreemenuById(Long id)
    {
        return rdaTreemenuMapper.deleteRdaTreemenuById(id);
    }
}
